home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / yelp / xslt / search2html.xsl < prev    next >
Extensible Markup Language  |  2009-10-15  |  5KB  |  172 lines

  1. <?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.                 xmlns:yelp="http://www.gnome.org/yelp/ns"
  4.                 xmlns="http://www.w3.org/1999/xhtml"
  5.                 extension-element-prefixes="yelp"
  6.                 version="1.0">
  7.  
  8. <xsl:param name="help_icon"/>
  9. <xsl:param name="help_icon_size"/>
  10.  
  11. <xsl:param name="yelp.javascript"/>
  12. <xsl:param name="yelp.topimage"/>
  13.  
  14. <xsl:param name="yelp.color.fg"/>
  15. <xsl:param name="yelp.color.bg"/>
  16. <xsl:param name="yelp.color.anchor"/>
  17. <xsl:param name="yelp.color.rule"/>
  18. <xsl:param name="yelp.color.gray.fg"/>
  19. <xsl:param name="yelp.color.gray.bg"/>
  20. <xsl:param name="yelp.color.gray.bg.dark1"/>
  21. <xsl:param name="yelp.color.gray.bg.dark2"/>
  22. <xsl:param name="yelp.color.gray.bg.dark3"/>
  23. <xsl:param name="yelp.color.selected.fg"/>
  24. <xsl:param name="yelp.color.selected.bg"/>
  25. <xsl:param name="yelp.color.selected.bg.dark1"/>
  26. <xsl:param name="yelp.color.selected.bg.dark2"/>
  27. <xsl:param name="yelp.color.selected.bg.dark3"/>
  28. <xsl:param name="yelp.color.admon.fg"/>
  29. <xsl:param name="yelp.color.admon.bg"/>
  30. <xsl:param name="yelp.color.admon.bg.dark1"/>
  31. <xsl:param name="yelp.color.admon.bg.dark2"/>
  32. <xsl:param name="yelp.color.admon.bg.dark3"/>
  33.  
  34. <xsl:template match="search">
  35.   <yelp:document href="results">
  36.     <html>
  37.       <head>
  38.         <title>
  39.           <xsl:value-of select="@title"/>
  40.         </title>
  41.         <script type="text/javascript">
  42.           <xsl:attribute name="src">
  43.             <xsl:value-of select="concat('file://', $yelp.javascript)"/>
  44.           </xsl:attribute>
  45.         </script>
  46.         <style type="text/css"><xsl:text>
  47.         body {
  48.           margin: 0px;
  49.           padding: 0px;
  50.           background-image: url("file://</xsl:text>
  51.           <xsl:value-of select="$yelp.topimage"/><xsl:text>");
  52.           background-position: 0px 0px;
  53.           background-repeat: no-repeat;
  54.           position: absolute;
  55.           width: 100%;
  56.         }
  57.         div.content {
  58.           margin-top: 36px;
  59.           padding-left: 38px;
  60.         }
  61.         div.header {
  62.           font-weight: bold;
  63.           border-bottom: 2px solid </xsl:text>
  64.           <xsl:value-of select="$yelp.color.gray.bg.dark1"/><xsl:text>;
  65.           margin-bottom: 0px;
  66.           padding-bottom: 0px;
  67.         }
  68.         div.footer {
  69.           padding-left: 38px;
  70.         }
  71.         ul { margin-left: 0em; padding-left: 0em; }
  72.         li {
  73.           margin-left: 1em;
  74.           padding-left: 0em;
  75.           list-style-type: none;
  76.         }
  77.         dl { margin-left: 36px; padding-left: 0em; }
  78.         dt { margin-top: 1em; }
  79.         dd { margin-left: 1em; margin-top: 0.5em; }
  80.         a { text-decoration: none; }
  81.         a:hover { text-decoration: underline; }
  82.         </xsl:text></style>
  83.       </head>
  84.       <body>
  85.         <div class="content">
  86.           <div class="header">
  87.             <h1><xsl:value-of select="title" /></h1>
  88.           </div>
  89.           <xsl:if test="text">
  90.             <p>
  91.               <xsl:value-of select="text" />
  92.             </p>
  93.           </xsl:if>
  94.           <dl>
  95.             <xsl:for-each select="result[@uri != '' and position() < 21]">
  96.               <!-- Don't sort.  Program deals with that. We do however 
  97.                    need it for slow search-->
  98.                 <xsl:sort order="descending" data-type="number" select="normalize-space(@score)"/>
  99.               <xsl:apply-templates select="."/>
  100.             </xsl:for-each>
  101.           </dl>
  102.         </div>
  103.         <div class="footer">
  104.             <br/>
  105.             <xsl:apply-templates select="online"/><xsl:apply-templates select="online1"/>
  106.           </div>
  107.       </body>
  108.     </html>
  109.   </yelp:document>
  110. </xsl:template>
  111.  
  112. <xsl:template match="result">
  113.   <dt>
  114.     <a href="{@uri}">
  115.       <xsl:choose>
  116.         <xsl:when test="@title != ''">
  117.           <xsl:value-of select="@title"/>
  118.         </xsl:when>
  119.         <xsl:otherwise>
  120.           <xsl:value-of select="@uri"/>
  121.         </xsl:otherwise>
  122.       </xsl:choose>
  123.     </a>
  124.     <xsl:choose>
  125.       <xsl:when test="@base_title != ''">
  126.         from <xsl:value-of select="@base_title"/>
  127.       </xsl:when>
  128.       <xsl:when test="@parent_uri != ''">
  129.         from <xsl:value-of select="@parent_uri"/>
  130.       </xsl:when>
  131.     </xsl:choose>
  132.   </dt>
  133.   <xsl:apply-templates/>
  134. </xsl:template>
  135.  
  136. <xsl:template match="snippet">
  137.   <dd>
  138.     <xsl:apply-templates/>
  139.   </dd>
  140. </xsl:template>
  141. <xsl:template match="font">
  142.   <span class="match">
  143.     <xsl:apply-templates/>
  144.   </span>
  145. </xsl:template>
  146. <xsl:template match="b">
  147.   <xsl:apply-templates/>
  148. </xsl:template>
  149.  
  150. <xsl:template match="em">
  151.   <strong>
  152.     <xsl:apply-templates/>
  153.   </strong>
  154. </xsl:template>
  155. <xsl:template match="score">
  156.   <!--Empty to kill score result-->
  157. </xsl:template>
  158.  
  159. <xsl:template match="online">
  160.   <hr/>
  161.   <br/>
  162.   <xsl:apply-templates/>
  163.   <a href="{@href}">
  164.     <xsl:value-of select="@name"/>
  165.   </a>
  166. </xsl:template>
  167. <xsl:template match="online1">
  168.   <xsl:apply-templates/>
  169. </xsl:template>
  170.  
  171. </xsl:stylesheet>
  172.